<template>
	<view class="user-info">
		<u-navbar
			title="设置"
			autoBack
			:placeholder="true"
		></u-navbar>
		<view class="content">
			<view class="user-info__avator">
				<view>头像</view>
				<view>
					<u-upload
						:fileList="avator"
						name="6"
						multiple
						:maxCount="1"
						width="250"
						height="150"
					>
						<image :src="avatorSrc" style="width: 130rpx;height: 130rpx;border-radius: 50%;"></image>
					</u-upload>
				</view>
			</view>
			<view class="user-info__item">
				<view class="user-info__item__title">昵称</view>
				<view class="user-info__item__value">
					<up-input
					    placeholder="请输入昵称"
					    border="none"
					    v-model="nickname"
						inputAlign="right"
					></up-input>
				</view>
			</view>
			<view class="user-info__item">
				<view class="user-info__item__title">性别</view>
				<view class="user-info__item__value">
					<u-radio-group
					    v-model="sex"
					>
					    <u-radio
					        :customStyle="{marginLeft: '8px'}"
					        shape="circle" label="男" name="男"
							activeColor="#f56c6c" 
					    >
					    </u-radio>
						<u-radio
						    :customStyle="{marginLeft: '8px'}"
						    shape="circle" label="女" name="女"
							activeColor="#f56c6c" 
						>
						</u-radio>
					</u-radio-group>
				</view>
			</view>
			<view class="user-info__item">
				<view class="user-info__item__title">公开信息 <text>评价、晒单</text></view>
				<view class="user-info__item__value">
					<u-switch v-model="openStatus" activeColor="#f56c6c"></u-switch>
				</view>
			</view>
			<view class="user-info__save">
				<u-button text="保存资料" color="#f56c6c" shape="circle" @click="saveInfo"></u-button>
			</view>
		</view>
		<u-toast ref="uToastRef"></u-toast>
	</view>
</template>

<script setup lang="ts">
	import {ref,onMounted,getCurrentInstance} from 'vue'
	
	const { proxy }: any = getCurrentInstance()
	const avator = ref([])
	const avatorSrc = ref('')
	const nickname = ref('')
	const sex = ref('')
	const openStatus = ref(false)
	
	const saveInfo = () => {
		
	}
	
	onMounted(()=>{
		let info = uni.getStorageSync("info");
		avatorSrc.value = proxy.$minioUrl + info.photo
		nickname.value = info.nickname
	})
</script>

<style lang="scss">
@import "style.scss"
</style>
